package com.zjs.jsp.status;

import com.currencyboot.RocketMqCurrencyBoot;
import com.currencyboot.service.rocketmq.messagelistener.Interface.MessageListenerConsumerInterface;
import com.currencyboot.service.rocketmq.spring.SpringContextUtils;
import com.zjs.jsp.status.configuration.CustomerBs;
import com.zjs.jsp.status.messagelistener.ConsumableMessageListenerConsumer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.client.RestTemplate;


@EnableFeignClients
@EnableScheduling
@EnableDiscoveryClient
@SpringBootApplication
@EnableConfigurationProperties(CustomerBs.class)
public class StateServiceApplication
{
    public static void main(String[] args) {
        //SpringApplication.run(StateServiceApplication.class, args);

        final ApplicationContext applicationContext =
                SpringApplication.run(new Object[]{RocketMqCurrencyBoot.class, StateServiceApplication.class}, args);
        SpringContextUtils.setApplicationContext(applicationContext);
    }

    @Bean
    @LoadBalanced
    RestTemplate restTemplate() {
        return new RestTemplate();
    }

    /**
     * 内销
     */
    @Bean
    MessageListenerConsumerInterface consumableMessageListenerConsumer() {
        return new ConsumableMessageListenerConsumer();
    }


}
